package com.vhall.component.entity.subject.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author shimingming
 * @since 2023/5/23 16:39
 */
@Getter
@AllArgsConstructor
public enum StatusEnum {

    CLOSE(0, "关"),

    OPEN(1, "开"),


    ;
    private final Integer value;

    private final String description;

    public static String getDescription(String value) {
        StatusEnum parse = parse(value);
        if (parse != null) {
            return parse.getDescription();
        }
        return StringUtils.EMPTY;
    }

    public static StatusEnum parse(String value) {
        for (StatusEnum anEnum : StatusEnum.values()) {
            if (anEnum.getValue().equals(value)) {
                return anEnum;
            }
        }
        return CLOSE;
    }

}
